package com.carorderdetail.model;

import java.sql.Date;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.apache.catalina.util.Base64;
import org.json.JSONArray;
import org.json.JSONException;

import com.member.model.MemberVO;

public class CarOrderDetailJsonHandler {

	
	public CarOrderDetailJsonHandler() {
		super();
	}

	public JSONArray toJSONArray(List<CarOrderDetailVO> carlistdetailPacks) {
		ArrayList<HashMap> list = new ArrayList<HashMap>();
		for (CarOrderDetailVO carorderdetailvo : carlistdetailPacks) {
			HashMap map = new HashMap();
			
			String orderDetailId = carorderdetailvo.getOrderDetailId();				
			String orderId = carorderdetailvo.getOrderId();	
			String riderPathId = carorderdetailvo.getRiderPathId();
			DateFormat df = DateFormat.getDateInstance();
			String createTime = df.format(carorderdetailvo.getCreateTime());
			String closeTime = df.format(carorderdetailvo.getCloseTime());		

			Integer fee =carorderdetailvo.getFee();
			String status = carorderdetailvo.getStatus();			
			String carPoolType = carorderdetailvo.getCarPoolType();
			

			
			map.put("orderDetailId", orderDetailId);
			map.put("orderId", orderId);
			map.put("riderPathId", riderPathId);
			map.put("createTime", createTime);
			map.put("closeTime", closeTime);
			map.put("fee", fee);
			map.put("status", status);
			map.put("carPoolType", carPoolType);
			list.add(map);
		}
		JSONArray travelPacksJson = new JSONArray(list);
		return travelPacksJson;
	}
	

	
	
	
	
	
	
}
